package o;

import android.os.Parcel;
import android.os.Parcelable;
import android.text.TextUtils;
import android.util.SparseIntArray;
import androidx.annotation.RestrictTo;
import androidx.annotation.RestrictTo.d;
import java.lang.reflect.Method;

@RestrictTo({d.LIBRARY})
public class pc extends pb {
    private final int ʻ;
    private final int ʼ;
    private int ʽ;
    private final SparseIntArray ˊ;
    private final Parcel ˋ;
    private int ˏॱ;
    private final String ॱॱ;
    private int ᐝ;

    public pc(Parcel parcel) {
        this(parcel, parcel.dataPosition(), parcel.dataSize(), "", new ds(), new ds(), new ds());
    }

    private pc(Parcel parcel, int i, int i2, String str, ds<String, Method> dsVar, ds<String, Method> dsVar2, ds<String, Class> dsVar3) {
        super(dsVar, dsVar2, dsVar3);
        this.ˊ = new SparseIntArray();
        this.ʽ = -1;
        this.ᐝ = 0;
        this.ˏॱ = -1;
        this.ˋ = parcel;
        this.ʼ = i;
        this.ʻ = i2;
        this.ᐝ = this.ʼ;
        this.ॱॱ = str;
    }

    public boolean ॱ(int i) {
        while (this.ᐝ < this.ʻ) {
            if (this.ˏॱ == i) {
                return true;
            }
            if (String.valueOf(this.ˏॱ).compareTo(String.valueOf(i)) > 0) {
                return false;
            }
            this.ˋ.setDataPosition(this.ᐝ);
            int readInt = this.ˋ.readInt();
            this.ˏॱ = this.ˋ.readInt();
            this.ᐝ = readInt + this.ᐝ;
        }
        if (this.ˏॱ != i) {
            return false;
        }
        return true;
    }

    public void ˏ(int i) {
        ˏ();
        this.ʽ = i;
        this.ˊ.put(i, this.ˋ.dataPosition());
        ˊ(0);
        ˊ(i);
    }

    public void ˏ() {
        if (this.ʽ >= 0) {
            int i = this.ˊ.get(this.ʽ);
            int dataPosition = this.ˋ.dataPosition();
            int i2 = dataPosition - i;
            this.ˋ.setDataPosition(i);
            this.ˋ.writeInt(i2);
            this.ˋ.setDataPosition(dataPosition);
        }
    }

    protected pb ˊ() {
        return new pc(this.ˋ, this.ˋ.dataPosition(), this.ᐝ == this.ʼ ? this.ʻ : this.ᐝ, this.ॱॱ + "  ", this.ˎ, this.ˏ, this.ॱ);
    }

    public void ॱ(byte[] bArr) {
        if (bArr != null) {
            this.ˋ.writeInt(bArr.length);
            this.ˋ.writeByteArray(bArr);
            return;
        }
        this.ˋ.writeInt(-1);
    }

    public void ˊ(int i) {
        this.ˋ.writeInt(i);
    }

    public void ॱ(String str) {
        this.ˋ.writeString(str);
    }

    public void ˊ(Parcelable parcelable) {
        this.ˋ.writeParcelable(parcelable, 0);
    }

    public void ˊ(boolean z) {
        this.ˋ.writeInt(z ? 1 : 0);
    }

    protected void ˋ(CharSequence charSequence) {
        TextUtils.writeToParcel(charSequence, this.ˋ, 0);
    }

    protected CharSequence ʻ() {
        return (CharSequence) TextUtils.CHAR_SEQUENCE_CREATOR.createFromParcel(this.ˋ);
    }

    public int ˋ() {
        return this.ˋ.readInt();
    }

    public String ˎ() {
        return this.ˋ.readString();
    }

    public byte[] ʽ() {
        int readInt = this.ˋ.readInt();
        if (readInt < 0) {
            return null;
        }
        byte[] bArr = new byte[readInt];
        this.ˋ.readByteArray(bArr);
        return bArr;
    }

    public <T extends Parcelable> T ʼ() {
        return this.ˋ.readParcelable(getClass().getClassLoader());
    }

    public boolean ॱॱ() {
        return this.ˋ.readInt() != 0;
    }
}
